package com.sxkiler.demo.test;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Mapper
@Repository
public interface DemoDao {
    @Select("SELECT balance FROM `account` where id = #{userid}")
    Integer getBalance(long userid);

    @Insert("Insert into `account`(`balance`)values(#{balance})")
    Integer addAccount(@Param("balance")long balance);

    @Insert("Insert into `product`(`price`,`stock`)values(#{price},#{stock})")
    Integer addProduct(@Param("price") int price,@Param("stock") int stock);
}
